{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "os.chdir('../')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import DeepPurpose.oneliner as oneliner\n",
    "from DeepPurpose import dataset\n",
    "import time"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "X_repurpose, drug_names, drug_CID = dataset.load_antiviral_drugs('./data')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Loading customized repurposing dataset...\n",
      "Checking if pretrained directory is valid...\n",
      "Beginning to load the pretrained models...\n",
      "Using pretrained model and making predictions...\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 1 with drug encoding MPNN and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 2 with drug encoding CNN and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 3 with drug encoding Morgan and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "-- Encoding AAC takes time. Time Reference: 24s for ~100 sequences in a CPU. Calculate your time by the unique target sequence #, instead of the entire dataset.\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 4 with drug encoding Morgan and target encoding AAC are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "-- Encoding AAC takes time. Time Reference: 24s for ~100 sequences in a CPU. Calculate your time by the unique target sequence #, instead of the entire dataset.\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 5 with drug encoding Daylight and target encoding AAC are done...\n",
      "-------------\n",
      "models prediction finished...\n",
      "aggregating results...\n",
      "---------------\n",
      "Drug Repurposing Result for SARS-CoV2 3CL Protease\n",
      "+------+----------------------+------------------------+---------------+\n",
      "| Rank |      Drug Name       |      Target Name       | Binding Score |\n",
      "+------+----------------------+------------------------+---------------+\n",
      "|  1   |      Sofosbuvir      | SARS-CoV2 3CL Protease |     360.22    |\n",
      "|  2   |     Daclatasvir      | SARS-CoV2 3CL Protease |     424.06    |\n",
      "|  3   |      Vicriviroc      | SARS-CoV2 3CL Protease |     623.78    |\n",
      "|  4   |      Efavirenz       | SARS-CoV2 3CL Protease |     768.33    |\n",
      "|  5   |      Simeprevir      | SARS-CoV2 3CL Protease |     781.29    |\n",
      "|  6   |      Etravirine      | SARS-CoV2 3CL Protease |     809.88    |\n",
      "|  7   |      Amantadine      | SARS-CoV2 3CL Protease |     826.28    |\n",
      "|  8   |      Letermovir      | SARS-CoV2 3CL Protease |     891.66    |\n",
      "|  9   |     Rilpivirine      | SARS-CoV2 3CL Protease |     929.63    |\n",
      "|  10  |      Ritonavir       | SARS-CoV2 3CL Protease |     941.13    |\n",
      "|  11  |      Darunavir       | SARS-CoV2 3CL Protease |     944.10    |\n",
      "|  12  |      Maraviroc       | SARS-CoV2 3CL Protease |     945.22    |\n",
      "|  13  |      Lopinavir       | SARS-CoV2 3CL Protease |     945.71    |\n",
      "|  14  |    Fosamprenavir     | SARS-CoV2 3CL Protease |     964.99    |\n",
      "|  15  |      Peramivir       | SARS-CoV2 3CL Protease |    1050.64    |\n",
      "|  16  |     Grazoprevir      | SARS-CoV2 3CL Protease |    1202.52    |\n",
      "|  17  |      Amprenavir      | SARS-CoV2 3CL Protease |    1204.21    |\n",
      "|  18  |      Telaprevir      | SARS-CoV2 3CL Protease |    1212.97    |\n",
      "|  19  |     Elvitegravir     | SARS-CoV2 3CL Protease |    1220.48    |\n",
      "|  20  |      Tenofovir       | SARS-CoV2 3CL Protease |    1250.70    |\n",
      "|  21  |       Descovy        | SARS-CoV2 3CL Protease |    1250.70    |\n",
      "|  22  |      Atazanavir      | SARS-CoV2 3CL Protease |    1348.65    |\n",
      "|  23  |     Tromantadine     | SARS-CoV2 3CL Protease |    1380.71    |\n",
      "|  24  |      Nelfinavir      | SARS-CoV2 3CL Protease |    1451.43    |\n",
      "|  25  |       Abacavir       | SARS-CoV2 3CL Protease |    1464.89    |\n",
      "|  26  | Tenofovir_disoproxil | SARS-CoV2 3CL Protease |    1571.85    |\n",
      "|  27  |     Dolutegravir     | SARS-CoV2 3CL Protease |    1672.82    |\n",
      "|  28  |     Delavirdine      | SARS-CoV2 3CL Protease |    1691.47    |\n",
      "|  29  |      Saquinavir      | SARS-CoV2 3CL Protease |    1763.63    |\n",
      "|  30  |     Raltegravir      | SARS-CoV2 3CL Protease |    1854.40    |\n",
      "checkout ./save_folder/results_aggregation/repurposing.txt for the whole list\n",
      "\n",
      "Time lapse:6.697427749633789\n"
     ]
    }
   ],
   "source": [
    "start = time.time()\n",
    "target, target_name = dataset.load_SARS_CoV2_Protease_3CL()\n",
    "oneliner.repurpose(target = target, \n",
    "                    target_name = target_name, \n",
    "                    X_repurpose = X_repurpose,\n",
    "                    drug_names = drug_names,\n",
    "                    save_dir = './save_folder',\n",
    "                    pretrained_dir = './save_folder/pretrained_models/DeepPurpose_BindingDB/',\n",
    "                    agg = 'mean')\n",
    "end = time.time()\n",
    "print('Time lapse:' + str(end - start))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Loading customized repurposing dataset...\n",
      "Checking if pretrained directory is valid...\n",
      "Beginning to load the pretrained models...\n",
      "Using pretrained model and making predictions...\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 1 with drug encoding MPNN and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 2 with drug encoding CNN and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 3 with drug encoding Morgan and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "-- Encoding AAC takes time. Time Reference: 24s for ~100 sequences in a CPU. Calculate your time by the unique target sequence #, instead of the entire dataset.\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 4 with drug encoding Morgan and target encoding AAC are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "-- Encoding AAC takes time. Time Reference: 24s for ~100 sequences in a CPU. Calculate your time by the unique target sequence #, instead of the entire dataset.\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 5 with drug encoding Daylight and target encoding AAC are done...\n",
      "-------------\n",
      "models prediction finished...\n",
      "aggregating results...\n",
      "---------------\n",
      "Drug Repurposing Result for SARS-CoV2 3CL Protease\n",
      "+------+----------------------+------------------------+---------------+\n",
      "| Rank |      Drug Name       |      Target Name       | Binding Score |\n",
      "+------+----------------------+------------------------+---------------+\n",
      "|  1   |      Lopinavir       | SARS-CoV2 3CL Protease |      0.30     |\n",
      "|  2   |      Darunavir       | SARS-CoV2 3CL Protease |      0.37     |\n",
      "|  3   |      Amprenavir      | SARS-CoV2 3CL Protease |      1.31     |\n",
      "|  4   |      Tipranavir      | SARS-CoV2 3CL Protease |      1.35     |\n",
      "|  5   |      Baloxavir       | SARS-CoV2 3CL Protease |      1.69     |\n",
      "|  6   |      Boceprevir      | SARS-CoV2 3CL Protease |      2.06     |\n",
      "|  7   |     Glecaprevir      | SARS-CoV2 3CL Protease |      2.22     |\n",
      "|  8   |     Oseltamivir      | SARS-CoV2 3CL Protease |      2.56     |\n",
      "|  9   |      Telaprevir      | SARS-CoV2 3CL Protease |      2.70     |\n",
      "|  10  |      Nelfinavir      | SARS-CoV2 3CL Protease |      3.56     |\n",
      "|  11  |      Maraviroc       | SARS-CoV2 3CL Protease |      4.50     |\n",
      "|  12  |     Daclatasvir      | SARS-CoV2 3CL Protease |      5.09     |\n",
      "|  13  |      Vicriviroc      | SARS-CoV2 3CL Protease |      7.62     |\n",
      "|  14  |      Etravirine      | SARS-CoV2 3CL Protease |      8.80     |\n",
      "|  15  |    Fosamprenavir     | SARS-CoV2 3CL Protease |      9.91     |\n",
      "|  16  |      Entecavir       | SARS-CoV2 3CL Protease |     10.25     |\n",
      "|  17  |      Atazanavir      | SARS-CoV2 3CL Protease |     10.41     |\n",
      "|  18  |      Foscarnet       | SARS-CoV2 3CL Protease |     11.34     |\n",
      "|  19  |      Simeprevir      | SARS-CoV2 3CL Protease |     11.76     |\n",
      "|  20  |     Rilpivirine      | SARS-CoV2 3CL Protease |     11.95     |\n",
      "|  21  |       Abacavir       | SARS-CoV2 3CL Protease |     12.70     |\n",
      "|  22  |      Amantadine      | SARS-CoV2 3CL Protease |     13.24     |\n",
      "|  23  |      Pleconaril      | SARS-CoV2 3CL Protease |     13.74     |\n",
      "|  24  |      Saquinavir      | SARS-CoV2 3CL Protease |     19.87     |\n",
      "|  25  |      Sofosbuvir      | SARS-CoV2 3CL Protease |     20.28     |\n",
      "|  26  |     Delavirdine      | SARS-CoV2 3CL Protease |     20.65     |\n",
      "|  27  |     Raltegravir      | SARS-CoV2 3CL Protease |     22.45     |\n",
      "|  28  |      Tenofovir       | SARS-CoV2 3CL Protease |     25.22     |\n",
      "|  29  |       Descovy        | SARS-CoV2 3CL Protease |     25.22     |\n",
      "|  30  |      Peramivir       | SARS-CoV2 3CL Protease |     25.57     |\n",
      "checkout ./save_folder/results_aggregation/repurposing.txt for the whole list\n",
      "\n"
     ]
    }
   ],
   "source": [
    "oneliner.repurpose(target = target, \n",
    "                    target_name = target_name, \n",
    "                    X_repurpose = X_repurpose,\n",
    "                    drug_names = drug_names,\n",
    "                    save_dir = './save_folder',\n",
    "                    pretrained_dir = './save_folder/pretrained_models/DeepPurpose_BindingDB/',\n",
    "                    agg = 'max_effect')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Loading customized repurposing dataset...\n",
      "Checking if pretrained directory is valid...\n",
      "Beginning to load the pretrained models...\n",
      "Using pretrained model and making predictions...\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 1 with drug encoding MPNN and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 2 with drug encoding CNN and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 3 with drug encoding Morgan and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "-- Encoding AAC takes time. Time Reference: 24s for ~100 sequences in a CPU. Calculate your time by the unique target sequence #, instead of the entire dataset.\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 4 with drug encoding Morgan and target encoding AAC are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "-- Encoding AAC takes time. Time Reference: 24s for ~100 sequences in a CPU. Calculate your time by the unique target sequence #, instead of the entire dataset.\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 5 with drug encoding Daylight and target encoding AAC are done...\n",
      "-------------\n",
      "models prediction finished...\n",
      "aggregating results...\n",
      "---------------\n",
      "Drug Repurposing Result for SARS-CoV2 3CL Protease\n",
      "+------+----------------------+------------------------+---------------+\n",
      "| Rank |      Drug Name       |      Target Name       | Binding Score |\n",
      "+------+----------------------+------------------------+---------------+\n",
      "|  1   |      Sofosbuvir      | SARS-CoV2 3CL Protease |     190.25    |\n",
      "|  2   |     Daclatasvir      | SARS-CoV2 3CL Protease |     214.58    |\n",
      "|  3   |      Vicriviroc      | SARS-CoV2 3CL Protease |     315.70    |\n",
      "|  4   |      Simeprevir      | SARS-CoV2 3CL Protease |     396.53    |\n",
      "|  5   |      Etravirine      | SARS-CoV2 3CL Protease |     409.34    |\n",
      "|  6   |      Amantadine      | SARS-CoV2 3CL Protease |     419.76    |\n",
      "|  7   |      Letermovir      | SARS-CoV2 3CL Protease |     460.28    |\n",
      "|  8   |     Rilpivirine      | SARS-CoV2 3CL Protease |     470.79    |\n",
      "|  9   |      Darunavir       | SARS-CoV2 3CL Protease |     472.24    |\n",
      "|  10  |      Lopinavir       | SARS-CoV2 3CL Protease |     473.01    |\n",
      "|  11  |      Maraviroc       | SARS-CoV2 3CL Protease |     474.86    |\n",
      "|  12  |    Fosamprenavir     | SARS-CoV2 3CL Protease |     487.45    |\n",
      "|  13  |      Ritonavir       | SARS-CoV2 3CL Protease |     492.19    |\n",
      "|  14  |      Efavirenz       | SARS-CoV2 3CL Protease |     513.81    |\n",
      "|  15  |      Peramivir       | SARS-CoV2 3CL Protease |     538.11    |\n",
      "|  16  |      Amprenavir      | SARS-CoV2 3CL Protease |     602.76    |\n",
      "|  17  |      Telaprevir      | SARS-CoV2 3CL Protease |     607.84    |\n",
      "|  18  |     Grazoprevir      | SARS-CoV2 3CL Protease |     632.54    |\n",
      "|  19  |      Tenofovir       | SARS-CoV2 3CL Protease |     637.96    |\n",
      "|  20  |       Descovy        | SARS-CoV2 3CL Protease |     637.96    |\n",
      "|  21  |     Elvitegravir     | SARS-CoV2 3CL Protease |     654.94    |\n",
      "|  22  |      Atazanavir      | SARS-CoV2 3CL Protease |     679.53    |\n",
      "|  23  |      Nelfinavir      | SARS-CoV2 3CL Protease |     727.49    |\n",
      "|  24  |       Abacavir       | SARS-CoV2 3CL Protease |     738.80    |\n",
      "|  25  | Tenofovir_disoproxil | SARS-CoV2 3CL Protease |     828.19    |\n",
      "|  26  |     Delavirdine      | SARS-CoV2 3CL Protease |     856.06    |\n",
      "|  27  |     Tromantadine     | SARS-CoV2 3CL Protease |     863.40    |\n",
      "|  28  |      Saquinavir      | SARS-CoV2 3CL Protease |     891.75    |\n",
      "|  29  |     Dolutegravir     | SARS-CoV2 3CL Protease |     920.32    |\n",
      "|  30  |     Raltegravir      | SARS-CoV2 3CL Protease |     938.42    |\n",
      "checkout ./save_folder/results_aggregation/repurposing.txt for the whole list\n",
      "\n"
     ]
    }
   ],
   "source": [
    "oneliner.repurpose(target = target, \n",
    "                    target_name = target_name, \n",
    "                    X_repurpose = X_repurpose,\n",
    "                    drug_names = drug_names,\n",
    "                    save_dir = './save_folder',\n",
    "                    pretrained_dir = './save_folder/pretrained_models/DeepPurpose_BindingDB/',\n",
    "                    agg = 'agg_mean_max')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Loading customized repurposing dataset...\n",
      "Checking if pretrained directory is valid...\n",
      "Beginning to load the pretrained models...\n",
      "Using pretrained model and making predictions...\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 1 with drug encoding MPNN and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 2 with drug encoding CNN and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 3 with drug encoding Morgan and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "-- Encoding AAC takes time. Time Reference: 24s for ~100 sequences in a CPU. Calculate your time by the unique target sequence #, instead of the entire dataset.\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 4 with drug encoding Morgan and target encoding AAC are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "-- Encoding AAC takes time. Time Reference: 24s for ~100 sequences in a CPU. Calculate your time by the unique target sequence #, instead of the entire dataset.\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 5 with drug encoding Daylight and target encoding AAC are done...\n",
      "-------------\n",
      "models prediction finished...\n",
      "aggregating results...\n",
      "---------------\n",
      "Drug Repurposing Result for RNA_polymerase_SARS_CoV2\n",
      "+------+----------------------+--------------------------+---------------+\n",
      "| Rank |      Drug Name       |       Target Name        | Binding Score |\n",
      "+------+----------------------+--------------------------+---------------+\n",
      "|  1   |     Daclatasvir      | RNA_polymerase_SARS_CoV2 |     380.69    |\n",
      "|  2   |      Vicriviroc      | RNA_polymerase_SARS_CoV2 |     404.62    |\n",
      "|  3   |      Simeprevir      | RNA_polymerase_SARS_CoV2 |     408.03    |\n",
      "|  4   |      Sofosbuvir      | RNA_polymerase_SARS_CoV2 |     647.43    |\n",
      "|  5   |      Etravirine      | RNA_polymerase_SARS_CoV2 |     735.35    |\n",
      "|  6   |      Atazanavir      | RNA_polymerase_SARS_CoV2 |     770.73    |\n",
      "|  7   |     Rilpivirine      | RNA_polymerase_SARS_CoV2 |     906.63    |\n",
      "|  8   |      Maraviroc       | RNA_polymerase_SARS_CoV2 |     911.97    |\n",
      "|  9   |      Letermovir      | RNA_polymerase_SARS_CoV2 |     932.10    |\n",
      "|  10  |      Lopinavir       | RNA_polymerase_SARS_CoV2 |     936.25    |\n",
      "|  11  |      Darunavir       | RNA_polymerase_SARS_CoV2 |     936.39    |\n",
      "|  12  |    Fosamprenavir     | RNA_polymerase_SARS_CoV2 |     945.02    |\n",
      "|  13  |      Peramivir       | RNA_polymerase_SARS_CoV2 |     964.85    |\n",
      "|  14  |      Telaprevir      | RNA_polymerase_SARS_CoV2 |    1123.34    |\n",
      "|  15  |      Amprenavir      | RNA_polymerase_SARS_CoV2 |    1202.55    |\n",
      "|  16  |     Grazoprevir      | RNA_polymerase_SARS_CoV2 |    1236.20    |\n",
      "|  17  |      Nelfinavir      | RNA_polymerase_SARS_CoV2 |    1252.00    |\n",
      "|  18  |      Boceprevir      | RNA_polymerase_SARS_CoV2 |    1391.99    |\n",
      "|  19  |     Raltegravir      | RNA_polymerase_SARS_CoV2 |    1552.78    |\n",
      "|  20  |       Abacavir       | RNA_polymerase_SARS_CoV2 |    1660.44    |\n",
      "|  21  |     Dolutegravir     | RNA_polymerase_SARS_CoV2 |    1718.55    |\n",
      "|  22  |     Delavirdine      | RNA_polymerase_SARS_CoV2 |    1746.95    |\n",
      "|  23  |      Doravirine      | RNA_polymerase_SARS_CoV2 |    1763.03    |\n",
      "|  24  |     Elvitegravir     | RNA_polymerase_SARS_CoV2 |    1821.02    |\n",
      "|  25  |      Saquinavir      | RNA_polymerase_SARS_CoV2 |    1829.28    |\n",
      "|  26  |     Enfuvirtide      | RNA_polymerase_SARS_CoV2 |    2177.03    |\n",
      "|  27  |      Pleconaril      | RNA_polymerase_SARS_CoV2 |    2266.15    |\n",
      "|  28  |     Glecaprevir      | RNA_polymerase_SARS_CoV2 |    2306.74    |\n",
      "|  29  |      Amantadine      | RNA_polymerase_SARS_CoV2 |    2434.83    |\n",
      "|  30  |      Efavirenz       | RNA_polymerase_SARS_CoV2 |    2617.99    |\n",
      "checkout ./save_folder/results_aggregation/repurposing.txt for the whole list\n",
      "\n"
     ]
    }
   ],
   "source": [
    "target, target_name = dataset.load_SARS_CoV2_RNA_polymerase()\n",
    "oneliner.repurpose(target = target, \n",
    "                    target_name = target_name, \n",
    "                    X_repurpose = X_repurpose,\n",
    "                    drug_names = drug_names,\n",
    "                    save_dir = './save_folder',\n",
    "                    pretrained_dir = './save_folder/pretrained_models/DeepPurpose_BindingDB/',\n",
    "                    agg = 'mean')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Loading customized repurposing dataset...\n",
      "Checking if pretrained directory is valid...\n",
      "Beginning to load the pretrained models...\n",
      "Using pretrained model and making predictions...\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 1 with drug encoding MPNN and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 2 with drug encoding CNN and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 3 with drug encoding Morgan and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "-- Encoding AAC takes time. Time Reference: 24s for ~100 sequences in a CPU. Calculate your time by the unique target sequence #, instead of the entire dataset.\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 4 with drug encoding Morgan and target encoding AAC are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "-- Encoding AAC takes time. Time Reference: 24s for ~100 sequences in a CPU. Calculate your time by the unique target sequence #, instead of the entire dataset.\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 5 with drug encoding Daylight and target encoding AAC are done...\n",
      "-------------\n",
      "models prediction finished...\n",
      "aggregating results...\n",
      "---------------\n",
      "Drug Repurposing Result for RNA_polymerase_SARS_CoV2\n",
      "+------+----------------------+--------------------------+---------------+\n",
      "| Rank |      Drug Name       |       Target Name        | Binding Score |\n",
      "+------+----------------------+--------------------------+---------------+\n",
      "|  1   |      Lopinavir       | RNA_polymerase_SARS_CoV2 |      0.28     |\n",
      "|  2   |      Darunavir       | RNA_polymerase_SARS_CoV2 |      0.36     |\n",
      "|  3   |      Amprenavir      | RNA_polymerase_SARS_CoV2 |      1.22     |\n",
      "|  4   |      Tipranavir      | RNA_polymerase_SARS_CoV2 |      5.41     |\n",
      "|  5   |      Sofosbuvir      | RNA_polymerase_SARS_CoV2 |      6.37     |\n",
      "|  6   |     Daclatasvir      | RNA_polymerase_SARS_CoV2 |      6.66     |\n",
      "|  7   |      Baloxavir       | RNA_polymerase_SARS_CoV2 |      7.39     |\n",
      "|  8   |      Pleconaril      | RNA_polymerase_SARS_CoV2 |      7.54     |\n",
      "|  9   |      Boceprevir      | RNA_polymerase_SARS_CoV2 |      8.10     |\n",
      "|  10  |      Vicriviroc      | RNA_polymerase_SARS_CoV2 |      8.32     |\n",
      "|  11  |    Fosamprenavir     | RNA_polymerase_SARS_CoV2 |      8.46     |\n",
      "|  12  |      Tenofovir       | RNA_polymerase_SARS_CoV2 |     10.18     |\n",
      "|  13  |       Descovy        | RNA_polymerase_SARS_CoV2 |     10.18     |\n",
      "|  14  |      Foscarnet       | RNA_polymerase_SARS_CoV2 |     10.84     |\n",
      "|  15  |      Nelfinavir      | RNA_polymerase_SARS_CoV2 |     11.13     |\n",
      "|  16  |     Oseltamivir      | RNA_polymerase_SARS_CoV2 |     11.73     |\n",
      "|  17  |      Maraviroc       | RNA_polymerase_SARS_CoV2 |     11.84     |\n",
      "|  18  |     Glecaprevir      | RNA_polymerase_SARS_CoV2 |     11.87     |\n",
      "|  19  |      Amantadine      | RNA_polymerase_SARS_CoV2 |     12.28     |\n",
      "|  20  |      Telaprevir      | RNA_polymerase_SARS_CoV2 |     12.56     |\n",
      "|  21  |       Arbidol        | RNA_polymerase_SARS_CoV2 |     14.80     |\n",
      "|  22  |      Remdesivir      | RNA_polymerase_SARS_CoV2 |     18.93     |\n",
      "|  23  |      Letermovir      | RNA_polymerase_SARS_CoV2 |     20.34     |\n",
      "|  24  |       Abacavir       | RNA_polymerase_SARS_CoV2 |     24.28     |\n",
      "|  25  |      Saquinavir      | RNA_polymerase_SARS_CoV2 |     25.48     |\n",
      "|  26  |     Rimantadine      | RNA_polymerase_SARS_CoV2 |     37.71     |\n",
      "|  27  |     Rilpivirine      | RNA_polymerase_SARS_CoV2 |     38.50     |\n",
      "|  28  |     Delavirdine      | RNA_polymerase_SARS_CoV2 |     40.78     |\n",
      "|  29  |      Ritonavir       | RNA_polymerase_SARS_CoV2 |     43.73     |\n",
      "|  30  |       Loviride       | RNA_polymerase_SARS_CoV2 |     63.94     |\n",
      "checkout ./save_folder/results_aggregation/repurposing.txt for the whole list\n",
      "\n"
     ]
    }
   ],
   "source": [
    "oneliner.repurpose(target = target, \n",
    "                    target_name = target_name, \n",
    "                    X_repurpose = X_repurpose,\n",
    "                    drug_names = drug_names,\n",
    "                    save_dir = './save_folder',\n",
    "                    pretrained_dir = './save_folder/pretrained_models/DeepPurpose_BindingDB/',\n",
    "                    agg = 'max_effect')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Loading customized repurposing dataset...\n",
      "Checking if pretrained directory is valid...\n",
      "Beginning to load the pretrained models...\n",
      "Using pretrained model and making predictions...\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 1 with drug encoding MPNN and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 2 with drug encoding CNN and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 3 with drug encoding Morgan and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "-- Encoding AAC takes time. Time Reference: 24s for ~100 sequences in a CPU. Calculate your time by the unique target sequence #, instead of the entire dataset.\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 4 with drug encoding Morgan and target encoding AAC are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "-- Encoding AAC takes time. Time Reference: 24s for ~100 sequences in a CPU. Calculate your time by the unique target sequence #, instead of the entire dataset.\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 5 with drug encoding Daylight and target encoding AAC are done...\n",
      "-------------\n",
      "models prediction finished...\n",
      "aggregating results...\n",
      "---------------\n",
      "Drug Repurposing Result for RNA_polymerase_SARS_CoV2\n",
      "+------+----------------------+--------------------------+---------------+\n",
      "| Rank |      Drug Name       |       Target Name        | Binding Score |\n",
      "+------+----------------------+--------------------------+---------------+\n",
      "|  1   |     Daclatasvir      | RNA_polymerase_SARS_CoV2 |     193.68    |\n",
      "|  2   |      Vicriviroc      | RNA_polymerase_SARS_CoV2 |     206.47    |\n",
      "|  3   |      Simeprevir      | RNA_polymerase_SARS_CoV2 |     247.13    |\n",
      "|  4   |      Sofosbuvir      | RNA_polymerase_SARS_CoV2 |     326.90    |\n",
      "|  5   |      Etravirine      | RNA_polymerase_SARS_CoV2 |     420.95    |\n",
      "|  6   |      Atazanavir      | RNA_polymerase_SARS_CoV2 |     422.32    |\n",
      "|  7   |      Maraviroc       | RNA_polymerase_SARS_CoV2 |     461.91    |\n",
      "|  8   |      Lopinavir       | RNA_polymerase_SARS_CoV2 |     468.27    |\n",
      "|  9   |      Darunavir       | RNA_polymerase_SARS_CoV2 |     468.37    |\n",
      "|  10  |     Rilpivirine      | RNA_polymerase_SARS_CoV2 |     472.57    |\n",
      "|  11  |      Letermovir      | RNA_polymerase_SARS_CoV2 |     476.22    |\n",
      "|  12  |    Fosamprenavir     | RNA_polymerase_SARS_CoV2 |     476.74    |\n",
      "|  13  |      Peramivir       | RNA_polymerase_SARS_CoV2 |     515.97    |\n",
      "|  14  |      Telaprevir      | RNA_polymerase_SARS_CoV2 |     567.95    |\n",
      "|  15  |      Amprenavir      | RNA_polymerase_SARS_CoV2 |     601.88    |\n",
      "|  16  |      Nelfinavir      | RNA_polymerase_SARS_CoV2 |     631.56    |\n",
      "|  17  |     Grazoprevir      | RNA_polymerase_SARS_CoV2 |     657.71    |\n",
      "|  18  |      Boceprevir      | RNA_polymerase_SARS_CoV2 |     700.05    |\n",
      "|  19  |       Abacavir       | RNA_polymerase_SARS_CoV2 |     842.36    |\n",
      "|  20  |     Raltegravir      | RNA_polymerase_SARS_CoV2 |     870.85    |\n",
      "|  21  |     Delavirdine      | RNA_polymerase_SARS_CoV2 |     893.87    |\n",
      "|  22  |      Saquinavir      | RNA_polymerase_SARS_CoV2 |     927.38    |\n",
      "|  23  |     Elvitegravir     | RNA_polymerase_SARS_CoV2 |     983.21    |\n",
      "|  24  |      Doravirine      | RNA_polymerase_SARS_CoV2 |    1034.73    |\n",
      "|  25  |     Dolutegravir     | RNA_polymerase_SARS_CoV2 |    1096.64    |\n",
      "|  26  |      Pleconaril      | RNA_polymerase_SARS_CoV2 |    1136.85    |\n",
      "|  27  |     Glecaprevir      | RNA_polymerase_SARS_CoV2 |    1159.31    |\n",
      "|  28  |     Enfuvirtide      | RNA_polymerase_SARS_CoV2 |    1212.25    |\n",
      "|  29  |      Amantadine      | RNA_polymerase_SARS_CoV2 |    1223.55    |\n",
      "|  30  |      Ritonavir       | RNA_polymerase_SARS_CoV2 |    1395.41    |\n",
      "checkout ./save_folder/results_aggregation/repurposing.txt for the whole list\n",
      "\n"
     ]
    }
   ],
   "source": [
    "oneliner.repurpose(target = target, \n",
    "                    target_name = target_name, \n",
    "                    X_repurpose = X_repurpose,\n",
    "                    drug_names = drug_names,\n",
    "                    save_dir = './save_folder',\n",
    "                    pretrained_dir = './save_folder/pretrained_models/DeepPurpose_BindingDB/',\n",
    "                    agg = 'agg_mean_max')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Loading customized repurposing dataset...\n",
      "Checking if pretrained directory is valid...\n",
      "Beginning to load the pretrained models...\n",
      "Using pretrained model and making predictions...\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 1 with drug encoding MPNN and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 2 with drug encoding CNN and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 3 with drug encoding Morgan and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "-- Encoding AAC takes time. Time Reference: 24s for ~100 sequences in a CPU. Calculate your time by the unique target sequence #, instead of the entire dataset.\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 4 with drug encoding Morgan and target encoding AAC are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "-- Encoding AAC takes time. Time Reference: 24s for ~100 sequences in a CPU. Calculate your time by the unique target sequence #, instead of the entire dataset.\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 5 with drug encoding Daylight and target encoding AAC are done...\n",
      "-------------\n",
      "models prediction finished...\n",
      "aggregating results...\n",
      "---------------\n",
      "Drug Repurposing Result for SARS_CoV2_Helicase\n",
      "+------+----------------------+--------------------+---------------+\n",
      "| Rank |      Drug Name       |    Target Name     | Binding Score |\n",
      "+------+----------------------+--------------------+---------------+\n",
      "|  1   |     Daclatasvir      | SARS_CoV2_Helicase |     422.51    |\n",
      "|  2   |      Simeprevir      | SARS_CoV2_Helicase |     436.10    |\n",
      "|  3   |      Sofosbuvir      | SARS_CoV2_Helicase |     460.44    |\n",
      "|  4   |      Vicriviroc      | SARS_CoV2_Helicase |     624.43    |\n",
      "|  5   |      Etravirine      | SARS_CoV2_Helicase |     749.41    |\n",
      "|  6   |      Atazanavir      | SARS_CoV2_Helicase |     822.11    |\n",
      "|  7   |     Rilpivirine      | SARS_CoV2_Helicase |     896.30    |\n",
      "|  8   |      Letermovir      | SARS_CoV2_Helicase |     904.84    |\n",
      "|  9   |     Grazoprevir      | SARS_CoV2_Helicase |     944.09    |\n",
      "|  10  |      Maraviroc       | SARS_CoV2_Helicase |     958.09    |\n",
      "|  11  |      Lopinavir       | SARS_CoV2_Helicase |     959.09    |\n",
      "|  12  |      Darunavir       | SARS_CoV2_Helicase |     960.77    |\n",
      "|  13  |      Peramivir       | SARS_CoV2_Helicase |     971.53    |\n",
      "|  14  |    Fosamprenavir     | SARS_CoV2_Helicase |     982.04    |\n",
      "|  15  | Tenofovir_disoproxil | SARS_CoV2_Helicase |    1025.72    |\n",
      "|  16  |      Amantadine      | SARS_CoV2_Helicase |    1067.12    |\n",
      "|  17  |      Efavirenz       | SARS_CoV2_Helicase |    1116.72    |\n",
      "|  18  |      Telaprevir      | SARS_CoV2_Helicase |    1188.83    |\n",
      "|  19  |      Amprenavir      | SARS_CoV2_Helicase |    1229.83    |\n",
      "|  20  |     Elvitegravir     | SARS_CoV2_Helicase |    1338.24    |\n",
      "|  21  |      Nelfinavir      | SARS_CoV2_Helicase |    1339.03    |\n",
      "|  22  |      Tenofovir       | SARS_CoV2_Helicase |    1370.97    |\n",
      "|  23  |       Descovy        | SARS_CoV2_Helicase |    1370.97    |\n",
      "|  24  |      Ritonavir       | SARS_CoV2_Helicase |    1405.82    |\n",
      "|  25  |      Doravirine      | SARS_CoV2_Helicase |    1477.56    |\n",
      "|  26  |       Abacavir       | SARS_CoV2_Helicase |    1498.16    |\n",
      "|  27  |      Boceprevir      | SARS_CoV2_Helicase |    1757.84    |\n",
      "|  28  |     Dolutegravir     | SARS_CoV2_Helicase |    1764.69    |\n",
      "|  29  |      Pleconaril      | SARS_CoV2_Helicase |    1787.40    |\n",
      "|  30  |     Delavirdine      | SARS_CoV2_Helicase |    1796.55    |\n",
      "checkout ./save_folder/results_aggregation/repurposing.txt for the whole list\n",
      "\n"
     ]
    }
   ],
   "source": [
    "target, target_name = dataset.load_SARS_CoV2_Helicase()\n",
    "oneliner.repurpose(target = target, \n",
    "                    target_name = target_name, \n",
    "                    X_repurpose = X_repurpose,\n",
    "                    drug_names = drug_names,\n",
    "                    save_dir = './save_folder',\n",
    "                    pretrained_dir = './save_folder/pretrained_models/DeepPurpose_BindingDB/',\n",
    "                    agg = 'mean')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Loading customized repurposing dataset...\n",
      "Checking if pretrained directory is valid...\n",
      "Beginning to load the pretrained models...\n",
      "Using pretrained model and making predictions...\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 1 with drug encoding MPNN and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 2 with drug encoding CNN and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 3 with drug encoding Morgan and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "-- Encoding AAC takes time. Time Reference: 24s for ~100 sequences in a CPU. Calculate your time by the unique target sequence #, instead of the entire dataset.\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 4 with drug encoding Morgan and target encoding AAC are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "-- Encoding AAC takes time. Time Reference: 24s for ~100 sequences in a CPU. Calculate your time by the unique target sequence #, instead of the entire dataset.\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 5 with drug encoding Daylight and target encoding AAC are done...\n",
      "-------------\n",
      "models prediction finished...\n",
      "aggregating results...\n",
      "---------------\n",
      "Drug Repurposing Result for SARS_CoV2_Helicase\n",
      "+------+----------------------+--------------------+---------------+\n",
      "| Rank |      Drug Name       |    Target Name     | Binding Score |\n",
      "+------+----------------------+--------------------+---------------+\n",
      "|  1   |      Lopinavir       | SARS_CoV2_Helicase |      0.26     |\n",
      "|  2   |      Darunavir       | SARS_CoV2_Helicase |      0.33     |\n",
      "|  3   |      Amprenavir      | SARS_CoV2_Helicase |      0.96     |\n",
      "|  4   |      Tipranavir      | SARS_CoV2_Helicase |      2.84     |\n",
      "|  5   |      Baloxavir       | SARS_CoV2_Helicase |      4.24     |\n",
      "|  6   |      Boceprevir      | SARS_CoV2_Helicase |      4.34     |\n",
      "|  7   |      Vicriviroc      | SARS_CoV2_Helicase |      5.51     |\n",
      "|  8   |    Fosamprenavir     | SARS_CoV2_Helicase |      5.58     |\n",
      "|  9   |     Oseltamivir      | SARS_CoV2_Helicase |      5.73     |\n",
      "|  10  |     Glecaprevir      | SARS_CoV2_Helicase |      5.78     |\n",
      "|  11  |      Telaprevir      | SARS_CoV2_Helicase |      6.22     |\n",
      "|  12  |     Daclatasvir      | SARS_CoV2_Helicase |      6.50     |\n",
      "|  13  |      Nelfinavir      | SARS_CoV2_Helicase |      8.26     |\n",
      "|  14  |      Amantadine      | SARS_CoV2_Helicase |     10.22     |\n",
      "|  15  |      Pleconaril      | SARS_CoV2_Helicase |     11.02     |\n",
      "|  16  |      Maraviroc       | SARS_CoV2_Helicase |     11.37     |\n",
      "|  17  |      Foscarnet       | SARS_CoV2_Helicase |     11.44     |\n",
      "|  18  |      Sofosbuvir      | SARS_CoV2_Helicase |     12.00     |\n",
      "|  19  |       Abacavir       | SARS_CoV2_Helicase |     15.96     |\n",
      "|  20  |      Tenofovir       | SARS_CoV2_Helicase |     18.68     |\n",
      "|  21  |       Descovy        | SARS_CoV2_Helicase |     18.68     |\n",
      "|  22  |       Arbidol        | SARS_CoV2_Helicase |     18.93     |\n",
      "|  23  |      Letermovir      | SARS_CoV2_Helicase |     20.55     |\n",
      "|  24  |      Ritonavir       | SARS_CoV2_Helicase |     26.00     |\n",
      "|  25  |     Rimantadine      | SARS_CoV2_Helicase |     26.93     |\n",
      "|  26  |      Remdesivir      | SARS_CoV2_Helicase |     27.36     |\n",
      "|  27  |      Atazanavir      | SARS_CoV2_Helicase |     29.60     |\n",
      "|  28  |      Saquinavir      | SARS_CoV2_Helicase |     29.99     |\n",
      "|  29  |      Simeprevir      | SARS_CoV2_Helicase |     32.97     |\n",
      "|  30  |      Etravirine      | SARS_CoV2_Helicase |     34.18     |\n",
      "checkout ./save_folder/results_aggregation/repurposing.txt for the whole list\n",
      "\n"
     ]
    }
   ],
   "source": [
    "oneliner.repurpose(target = target, \n",
    "                    target_name = target_name, \n",
    "                    X_repurpose = X_repurpose,\n",
    "                    drug_names = drug_names,\n",
    "                    save_dir = './save_folder',\n",
    "                    pretrained_dir = './save_folder/pretrained_models/DeepPurpose_BindingDB/',\n",
    "                    agg = 'max_effect')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Loading customized repurposing dataset...\n",
      "Checking if pretrained directory is valid...\n",
      "Beginning to load the pretrained models...\n",
      "Using pretrained model and making predictions...\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 1 with drug encoding MPNN and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 2 with drug encoding CNN and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 3 with drug encoding Morgan and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "-- Encoding AAC takes time. Time Reference: 24s for ~100 sequences in a CPU. Calculate your time by the unique target sequence #, instead of the entire dataset.\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 4 with drug encoding Morgan and target encoding AAC are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "-- Encoding AAC takes time. Time Reference: 24s for ~100 sequences in a CPU. Calculate your time by the unique target sequence #, instead of the entire dataset.\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 5 with drug encoding Daylight and target encoding AAC are done...\n",
      "-------------\n",
      "models prediction finished...\n",
      "aggregating results...\n",
      "---------------\n",
      "Drug Repurposing Result for SARS_CoV2_Helicase\n",
      "+------+----------------------+--------------------+---------------+\n",
      "| Rank |      Drug Name       |    Target Name     | Binding Score |\n",
      "+------+----------------------+--------------------+---------------+\n",
      "|  1   |     Daclatasvir      | SARS_CoV2_Helicase |     214.51    |\n",
      "|  2   |      Simeprevir      | SARS_CoV2_Helicase |     234.54    |\n",
      "|  3   |      Sofosbuvir      | SARS_CoV2_Helicase |     236.22    |\n",
      "|  4   |      Vicriviroc      | SARS_CoV2_Helicase |     314.97    |\n",
      "|  5   |      Etravirine      | SARS_CoV2_Helicase |     391.80    |\n",
      "|  6   |      Atazanavir      | SARS_CoV2_Helicase |     425.85    |\n",
      "|  7   |      Letermovir      | SARS_CoV2_Helicase |     462.70    |\n",
      "|  8   |     Rilpivirine      | SARS_CoV2_Helicase |     474.99    |\n",
      "|  9   |      Lopinavir       | SARS_CoV2_Helicase |     479.67    |\n",
      "|  10  |      Darunavir       | SARS_CoV2_Helicase |     480.55    |\n",
      "|  11  |      Maraviroc       | SARS_CoV2_Helicase |     484.73    |\n",
      "|  12  |    Fosamprenavir     | SARS_CoV2_Helicase |     493.81    |\n",
      "|  13  |      Peramivir       | SARS_CoV2_Helicase |     516.79    |\n",
      "|  14  |     Grazoprevir      | SARS_CoV2_Helicase |     525.42    |\n",
      "|  15  |      Amantadine      | SARS_CoV2_Helicase |     538.67    |\n",
      "|  16  |      Telaprevir      | SARS_CoV2_Helicase |     597.52    |\n",
      "|  17  |      Amprenavir      | SARS_CoV2_Helicase |     615.40    |\n",
      "|  18  | Tenofovir_disoproxil | SARS_CoV2_Helicase |     620.33    |\n",
      "|  19  |      Nelfinavir      | SARS_CoV2_Helicase |     673.65    |\n",
      "|  20  |      Efavirenz       | SARS_CoV2_Helicase |     689.13    |\n",
      "|  21  |      Tenofovir       | SARS_CoV2_Helicase |     694.82    |\n",
      "|  22  |       Descovy        | SARS_CoV2_Helicase |     694.82    |\n",
      "|  23  |      Ritonavir       | SARS_CoV2_Helicase |     715.91    |\n",
      "|  24  |     Elvitegravir     | SARS_CoV2_Helicase |     729.73    |\n",
      "|  25  |       Abacavir       | SARS_CoV2_Helicase |     757.06    |\n",
      "|  26  |      Doravirine      | SARS_CoV2_Helicase |     800.64    |\n",
      "|  27  |      Boceprevir      | SARS_CoV2_Helicase |     881.09    |\n",
      "|  28  |      Pleconaril      | SARS_CoV2_Helicase |     899.21    |\n",
      "|  29  |     Delavirdine      | SARS_CoV2_Helicase |     924.90    |\n",
      "|  30  |     Raltegravir      | SARS_CoV2_Helicase |     934.50    |\n",
      "checkout ./save_folder/results_aggregation/repurposing.txt for the whole list\n",
      "\n"
     ]
    }
   ],
   "source": [
    "oneliner.repurpose(target = target, \n",
    "                    target_name = target_name, \n",
    "                    X_repurpose = X_repurpose,\n",
    "                    drug_names = drug_names,\n",
    "                    save_dir = './save_folder',\n",
    "                    pretrained_dir = './save_folder/pretrained_models/DeepPurpose_BindingDB/',\n",
    "                    agg = 'agg_mean_max')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Loading customized repurposing dataset...\n",
      "Checking if pretrained directory is valid...\n",
      "Beginning to load the pretrained models...\n",
      "Using pretrained model and making predictions...\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 1 with drug encoding MPNN and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 2 with drug encoding CNN and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 3 with drug encoding Morgan and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "-- Encoding AAC takes time. Time Reference: 24s for ~100 sequences in a CPU. Calculate your time by the unique target sequence #, instead of the entire dataset.\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 4 with drug encoding Morgan and target encoding AAC are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "-- Encoding AAC takes time. Time Reference: 24s for ~100 sequences in a CPU. Calculate your time by the unique target sequence #, instead of the entire dataset.\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 5 with drug encoding Daylight and target encoding AAC are done...\n",
      "-------------\n",
      "models prediction finished...\n",
      "aggregating results...\n",
      "---------------\n",
      "Drug Repurposing Result for SARS_CoV2_3to5_exonuclease\n",
      "+------+----------------------+----------------------------+---------------+\n",
      "| Rank |      Drug Name       |        Target Name         | Binding Score |\n",
      "+------+----------------------+----------------------------+---------------+\n",
      "|  1   |      Sofosbuvir      | SARS_CoV2_3to5_exonuclease |     331.42    |\n",
      "|  2   |      Simeprevir      | SARS_CoV2_3to5_exonuclease |     357.64    |\n",
      "|  3   |     Daclatasvir      | SARS_CoV2_3to5_exonuclease |     391.05    |\n",
      "|  4   |      Vicriviroc      | SARS_CoV2_3to5_exonuclease |     511.83    |\n",
      "|  5   |      Atazanavir      | SARS_CoV2_3to5_exonuclease |     669.99    |\n",
      "|  6   |      Etravirine      | SARS_CoV2_3to5_exonuclease |     717.46    |\n",
      "|  7   | Tenofovir_disoproxil | SARS_CoV2_3to5_exonuclease |     733.86    |\n",
      "|  8   |      Efavirenz       | SARS_CoV2_3to5_exonuclease |     767.65    |\n",
      "|  9   |     Grazoprevir      | SARS_CoV2_3to5_exonuclease |     820.81    |\n",
      "|  10  |     Rilpivirine      | SARS_CoV2_3to5_exonuclease |     859.15    |\n",
      "|  11  |      Letermovir      | SARS_CoV2_3to5_exonuclease |     865.38    |\n",
      "|  12  |      Peramivir       | SARS_CoV2_3to5_exonuclease |     877.47    |\n",
      "|  13  |      Lopinavir       | SARS_CoV2_3to5_exonuclease |     925.16    |\n",
      "|  14  |      Darunavir       | SARS_CoV2_3to5_exonuclease |     930.19    |\n",
      "|  15  |      Maraviroc       | SARS_CoV2_3to5_exonuclease |     933.72    |\n",
      "|  16  |    Fosamprenavir     | SARS_CoV2_3to5_exonuclease |     952.93    |\n",
      "|  17  |     Elvitegravir     | SARS_CoV2_3to5_exonuclease |     971.27    |\n",
      "|  18  |      Amantadine      | SARS_CoV2_3to5_exonuclease |     977.99    |\n",
      "|  19  |      Telaprevir      | SARS_CoV2_3to5_exonuclease |    1103.15    |\n",
      "|  20  |      Tenofovir       | SARS_CoV2_3to5_exonuclease |    1111.73    |\n",
      "|  21  |       Descovy        | SARS_CoV2_3to5_exonuclease |    1111.73    |\n",
      "|  22  |      Boceprevir      | SARS_CoV2_3to5_exonuclease |    1137.67    |\n",
      "|  23  |      Nelfinavir      | SARS_CoV2_3to5_exonuclease |    1189.33    |\n",
      "|  24  |      Amprenavir      | SARS_CoV2_3to5_exonuclease |    1190.66    |\n",
      "|  25  |      Doravirine      | SARS_CoV2_3to5_exonuclease |    1240.21    |\n",
      "|  26  |      Ritonavir       | SARS_CoV2_3to5_exonuclease |    1310.21    |\n",
      "|  27  |       Abacavir       | SARS_CoV2_3to5_exonuclease |    1424.62    |\n",
      "|  28  |     Raltegravir      | SARS_CoV2_3to5_exonuclease |    1515.33    |\n",
      "|  29  |     Dolutegravir     | SARS_CoV2_3to5_exonuclease |    1593.56    |\n",
      "|  30  |      Pleconaril      | SARS_CoV2_3to5_exonuclease |    1645.66    |\n",
      "checkout ./save_folder/results_aggregation/repurposing.txt for the whole list\n",
      "\n"
     ]
    }
   ],
   "source": [
    "target, target_name = dataset.load_SARS_CoV2_3to5_exonuclease()\n",
    "oneliner.repurpose(target = target, \n",
    "                    target_name = target_name, \n",
    "                    X_repurpose = X_repurpose,\n",
    "                    drug_names = drug_names,\n",
    "                    save_dir = './save_folder',\n",
    "                    pretrained_dir = './save_folder/pretrained_models/DeepPurpose_BindingDB/',\n",
    "                    agg = 'mean')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Loading customized repurposing dataset...\n",
      "Checking if pretrained directory is valid...\n",
      "Beginning to load the pretrained models...\n",
      "Using pretrained model and making predictions...\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 1 with drug encoding MPNN and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 2 with drug encoding CNN and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 3 with drug encoding Morgan and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "-- Encoding AAC takes time. Time Reference: 24s for ~100 sequences in a CPU. Calculate your time by the unique target sequence #, instead of the entire dataset.\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 4 with drug encoding Morgan and target encoding AAC are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "-- Encoding AAC takes time. Time Reference: 24s for ~100 sequences in a CPU. Calculate your time by the unique target sequence #, instead of the entire dataset.\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 5 with drug encoding Daylight and target encoding AAC are done...\n",
      "-------------\n",
      "models prediction finished...\n",
      "aggregating results...\n",
      "---------------\n",
      "Drug Repurposing Result for SARS_CoV2_3to5_exonuclease\n",
      "+------+----------------------+----------------------------+---------------+\n",
      "| Rank |      Drug Name       |        Target Name         | Binding Score |\n",
      "+------+----------------------+----------------------------+---------------+\n",
      "|  1   |      Lopinavir       | SARS_CoV2_3to5_exonuclease |      0.21     |\n",
      "|  2   |      Darunavir       | SARS_CoV2_3to5_exonuclease |      0.26     |\n",
      "|  3   |      Amprenavir      | SARS_CoV2_3to5_exonuclease |      0.77     |\n",
      "|  4   |      Tipranavir      | SARS_CoV2_3to5_exonuclease |      1.98     |\n",
      "|  5   |      Baloxavir       | SARS_CoV2_3to5_exonuclease |      2.76     |\n",
      "|  6   |      Boceprevir      | SARS_CoV2_3to5_exonuclease |      3.35     |\n",
      "|  7   |     Glecaprevir      | SARS_CoV2_3to5_exonuclease |      3.63     |\n",
      "|  8   |     Oseltamivir      | SARS_CoV2_3to5_exonuclease |      4.12     |\n",
      "|  9   |      Telaprevir      | SARS_CoV2_3to5_exonuclease |      4.44     |\n",
      "|  10  |      Nelfinavir      | SARS_CoV2_3to5_exonuclease |      5.15     |\n",
      "|  11  |     Daclatasvir      | SARS_CoV2_3to5_exonuclease |      5.31     |\n",
      "|  12  |      Vicriviroc      | SARS_CoV2_3to5_exonuclease |      5.57     |\n",
      "|  13  |    Fosamprenavir     | SARS_CoV2_3to5_exonuclease |      5.64     |\n",
      "|  14  |      Maraviroc       | SARS_CoV2_3to5_exonuclease |      7.09     |\n",
      "|  15  |      Amantadine      | SARS_CoV2_3to5_exonuclease |      8.80     |\n",
      "|  16  |      Etravirine      | SARS_CoV2_3to5_exonuclease |     10.17     |\n",
      "|  17  |      Foscarnet       | SARS_CoV2_3to5_exonuclease |     11.20     |\n",
      "|  18  |      Entecavir       | SARS_CoV2_3to5_exonuclease |     13.15     |\n",
      "|  19  |     Rilpivirine      | SARS_CoV2_3to5_exonuclease |     14.35     |\n",
      "|  20  |      Atazanavir      | SARS_CoV2_3to5_exonuclease |     14.42     |\n",
      "|  21  |      Simeprevir      | SARS_CoV2_3to5_exonuclease |     14.67     |\n",
      "|  22  |      Sofosbuvir      | SARS_CoV2_3to5_exonuclease |     15.18     |\n",
      "|  23  |      Pleconaril      | SARS_CoV2_3to5_exonuclease |     15.20     |\n",
      "|  24  |       Abacavir       | SARS_CoV2_3to5_exonuclease |     16.05     |\n",
      "|  25  |       Arbidol        | SARS_CoV2_3to5_exonuclease |     18.36     |\n",
      "|  26  |      Saquinavir      | SARS_CoV2_3to5_exonuclease |     19.92     |\n",
      "|  27  |      Tenofovir       | SARS_CoV2_3to5_exonuclease |     20.45     |\n",
      "|  28  |       Descovy        | SARS_CoV2_3to5_exonuclease |     20.45     |\n",
      "|  29  |      Ritonavir       | SARS_CoV2_3to5_exonuclease |     26.42     |\n",
      "|  30  |      Letermovir      | SARS_CoV2_3to5_exonuclease |     26.89     |\n",
      "checkout ./save_folder/results_aggregation/repurposing.txt for the whole list\n",
      "\n"
     ]
    }
   ],
   "source": [
    "oneliner.repurpose(target = target, \n",
    "                    target_name = target_name, \n",
    "                    X_repurpose = X_repurpose,\n",
    "                    drug_names = drug_names,\n",
    "                    save_dir = './save_folder',\n",
    "                    pretrained_dir = './save_folder/pretrained_models/DeepPurpose_BindingDB/',\n",
    "                    agg = 'max_effect')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Loading customized repurposing dataset...\n",
      "Checking if pretrained directory is valid...\n",
      "Beginning to load the pretrained models...\n",
      "Using pretrained model and making predictions...\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 1 with drug encoding MPNN and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 2 with drug encoding CNN and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 3 with drug encoding Morgan and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "-- Encoding AAC takes time. Time Reference: 24s for ~100 sequences in a CPU. Calculate your time by the unique target sequence #, instead of the entire dataset.\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 4 with drug encoding Morgan and target encoding AAC are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "-- Encoding AAC takes time. Time Reference: 24s for ~100 sequences in a CPU. Calculate your time by the unique target sequence #, instead of the entire dataset.\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 5 with drug encoding Daylight and target encoding AAC are done...\n",
      "-------------\n",
      "models prediction finished...\n",
      "aggregating results...\n",
      "---------------\n",
      "Drug Repurposing Result for SARS_CoV2_3to5_exonuclease\n",
      "+------+----------------------+----------------------------+---------------+\n",
      "| Rank |      Drug Name       |        Target Name         | Binding Score |\n",
      "+------+----------------------+----------------------------+---------------+\n",
      "|  1   |      Sofosbuvir      | SARS_CoV2_3to5_exonuclease |     173.30    |\n",
      "|  2   |      Simeprevir      | SARS_CoV2_3to5_exonuclease |     186.16    |\n",
      "|  3   |     Daclatasvir      | SARS_CoV2_3to5_exonuclease |     198.18    |\n",
      "|  4   |      Vicriviroc      | SARS_CoV2_3to5_exonuclease |     258.70    |\n",
      "|  5   |      Atazanavir      | SARS_CoV2_3to5_exonuclease |     342.21    |\n",
      "|  6   |      Etravirine      | SARS_CoV2_3to5_exonuclease |     363.81    |\n",
      "|  7   | Tenofovir_disoproxil | SARS_CoV2_3to5_exonuclease |     430.66    |\n",
      "|  8   |     Rilpivirine      | SARS_CoV2_3to5_exonuclease |     436.75    |\n",
      "|  9   |      Letermovir      | SARS_CoV2_3to5_exonuclease |     446.13    |\n",
      "|  10  |      Peramivir       | SARS_CoV2_3to5_exonuclease |     456.39    |\n",
      "|  11  |      Lopinavir       | SARS_CoV2_3to5_exonuclease |     462.68    |\n",
      "|  12  |     Grazoprevir      | SARS_CoV2_3to5_exonuclease |     463.52    |\n",
      "|  13  |      Darunavir       | SARS_CoV2_3to5_exonuclease |     465.23    |\n",
      "|  14  |      Maraviroc       | SARS_CoV2_3to5_exonuclease |     470.40    |\n",
      "|  15  |    Fosamprenavir     | SARS_CoV2_3to5_exonuclease |     479.29    |\n",
      "|  16  |      Amantadine      | SARS_CoV2_3to5_exonuclease |     493.40    |\n",
      "|  17  |      Efavirenz       | SARS_CoV2_3to5_exonuclease |     511.76    |\n",
      "|  18  |     Elvitegravir     | SARS_CoV2_3to5_exonuclease |     546.67    |\n",
      "|  19  |      Telaprevir      | SARS_CoV2_3to5_exonuclease |     553.80    |\n",
      "|  20  |      Tenofovir       | SARS_CoV2_3to5_exonuclease |     566.09    |\n",
      "|  21  |       Descovy        | SARS_CoV2_3to5_exonuclease |     566.09    |\n",
      "|  22  |      Boceprevir      | SARS_CoV2_3to5_exonuclease |     570.51    |\n",
      "|  23  |      Amprenavir      | SARS_CoV2_3to5_exonuclease |     595.71    |\n",
      "|  24  |      Nelfinavir      | SARS_CoV2_3to5_exonuclease |     597.24    |\n",
      "|  25  |      Doravirine      | SARS_CoV2_3to5_exonuclease |     650.27    |\n",
      "|  26  |      Ritonavir       | SARS_CoV2_3to5_exonuclease |     668.31    |\n",
      "|  27  |       Abacavir       | SARS_CoV2_3to5_exonuclease |     720.33    |\n",
      "|  28  |     Raltegravir      | SARS_CoV2_3to5_exonuclease |     771.92    |\n",
      "|  29  |      Pleconaril      | SARS_CoV2_3to5_exonuclease |     830.43    |\n",
      "|  30  |     Delavirdine      | SARS_CoV2_3to5_exonuclease |     864.18    |\n",
      "checkout ./save_folder/results_aggregation/repurposing.txt for the whole list\n",
      "\n"
     ]
    }
   ],
   "source": [
    "oneliner.repurpose(target = target, \n",
    "                    target_name = target_name, \n",
    "                    X_repurpose = X_repurpose,\n",
    "                    drug_names = drug_names,\n",
    "                    save_dir = './save_folder',\n",
    "                    pretrained_dir = './save_folder/pretrained_models/DeepPurpose_BindingDB/',\n",
    "                    agg = 'agg_mean_max')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Loading customized repurposing dataset...\n",
      "Checking if pretrained directory is valid...\n",
      "Beginning to load the pretrained models...\n",
      "Using pretrained model and making predictions...\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 1 with drug encoding MPNN and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 2 with drug encoding CNN and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 3 with drug encoding Morgan and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "-- Encoding AAC takes time. Time Reference: 24s for ~100 sequences in a CPU. Calculate your time by the unique target sequence #, instead of the entire dataset.\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 4 with drug encoding Morgan and target encoding AAC are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "-- Encoding AAC takes time. Time Reference: 24s for ~100 sequences in a CPU. Calculate your time by the unique target sequence #, instead of the entire dataset.\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 5 with drug encoding Daylight and target encoding AAC are done...\n",
      "-------------\n",
      "models prediction finished...\n",
      "aggregating results...\n",
      "---------------\n",
      "Drug Repurposing Result for SARS_CoV2_endoRNAse\n",
      "+------+----------------------+---------------------+---------------+\n",
      "| Rank |      Drug Name       |     Target Name     | Binding Score |\n",
      "+------+----------------------+---------------------+---------------+\n",
      "|  1   |     Daclatasvir      | SARS_CoV2_endoRNAse |     425.21    |\n",
      "|  2   |      Simeprevir      | SARS_CoV2_endoRNAse |     464.11    |\n",
      "|  3   |      Sofosbuvir      | SARS_CoV2_endoRNAse |     561.39    |\n",
      "|  4   |      Vicriviroc      | SARS_CoV2_endoRNAse |     794.73    |\n",
      "|  5   |      Etravirine      | SARS_CoV2_endoRNAse |     795.08    |\n",
      "|  6   |      Atazanavir      | SARS_CoV2_endoRNAse |     811.34    |\n",
      "|  7   |     Rilpivirine      | SARS_CoV2_endoRNAse |     869.46    |\n",
      "|  8   |      Letermovir      | SARS_CoV2_endoRNAse |     879.67    |\n",
      "|  9   |      Maraviroc       | SARS_CoV2_endoRNAse |     915.73    |\n",
      "|  10  |      Darunavir       | SARS_CoV2_endoRNAse |     919.07    |\n",
      "|  11  |      Lopinavir       | SARS_CoV2_endoRNAse |     919.69    |\n",
      "|  12  |      Peramivir       | SARS_CoV2_endoRNAse |     939.63    |\n",
      "|  13  |    Fosamprenavir     | SARS_CoV2_endoRNAse |     941.33    |\n",
      "|  14  |     Grazoprevir      | SARS_CoV2_endoRNAse |    1118.11    |\n",
      "|  15  |      Telaprevir      | SARS_CoV2_endoRNAse |    1142.64    |\n",
      "|  16  |      Amprenavir      | SARS_CoV2_endoRNAse |    1176.82    |\n",
      "|  17  |      Amantadine      | SARS_CoV2_endoRNAse |    1190.22    |\n",
      "|  18  |      Nelfinavir      | SARS_CoV2_endoRNAse |    1289.00    |\n",
      "|  19  |     Elvitegravir     | SARS_CoV2_endoRNAse |    1517.18    |\n",
      "|  20  |      Doravirine      | SARS_CoV2_endoRNAse |    1574.81    |\n",
      "|  21  |      Boceprevir      | SARS_CoV2_endoRNAse |    1595.57    |\n",
      "|  22  |     Raltegravir      | SARS_CoV2_endoRNAse |    1661.85    |\n",
      "|  23  | Tenofovir_disoproxil | SARS_CoV2_endoRNAse |    1707.86    |\n",
      "|  24  |     Delavirdine      | SARS_CoV2_endoRNAse |    1775.90    |\n",
      "|  25  |       Abacavir       | SARS_CoV2_endoRNAse |    1809.39    |\n",
      "|  26  |      Saquinavir      | SARS_CoV2_endoRNAse |    1812.37    |\n",
      "|  27  |     Dolutegravir     | SARS_CoV2_endoRNAse |    1855.91    |\n",
      "|  28  |      Ritonavir       | SARS_CoV2_endoRNAse |    1902.92    |\n",
      "|  29  |     Glecaprevir      | SARS_CoV2_endoRNAse |    2152.12    |\n",
      "|  30  |      Pleconaril      | SARS_CoV2_endoRNAse |    2189.36    |\n",
      "checkout ./save_folder/results_aggregation/repurposing.txt for the whole list\n",
      "\n"
     ]
    }
   ],
   "source": [
    "target, target_name = dataset.load_SARS_CoV2_endoRNAse()\n",
    "oneliner.repurpose(target = target, \n",
    "                    target_name = target_name, \n",
    "                    X_repurpose = X_repurpose,\n",
    "                    drug_names = drug_names,\n",
    "                    save_dir = './save_folder',\n",
    "                    pretrained_dir = './save_folder/pretrained_models/DeepPurpose_BindingDB/',\n",
    "                    agg = 'mean')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Loading customized repurposing dataset...\n",
      "Checking if pretrained directory is valid...\n",
      "Beginning to load the pretrained models...\n",
      "Using pretrained model and making predictions...\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 1 with drug encoding MPNN and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 2 with drug encoding CNN and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 3 with drug encoding Morgan and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "-- Encoding AAC takes time. Time Reference: 24s for ~100 sequences in a CPU. Calculate your time by the unique target sequence #, instead of the entire dataset.\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 4 with drug encoding Morgan and target encoding AAC are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "-- Encoding AAC takes time. Time Reference: 24s for ~100 sequences in a CPU. Calculate your time by the unique target sequence #, instead of the entire dataset.\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 5 with drug encoding Daylight and target encoding AAC are done...\n",
      "-------------\n",
      "models prediction finished...\n",
      "aggregating results...\n",
      "---------------\n",
      "Drug Repurposing Result for SARS_CoV2_endoRNAse\n",
      "+------+----------------------+---------------------+---------------+\n",
      "| Rank |      Drug Name       |     Target Name     | Binding Score |\n",
      "+------+----------------------+---------------------+---------------+\n",
      "|  1   |      Lopinavir       | SARS_CoV2_endoRNAse |      0.18     |\n",
      "|  2   |      Darunavir       | SARS_CoV2_endoRNAse |      0.23     |\n",
      "|  3   |      Amprenavir      | SARS_CoV2_endoRNAse |      0.80     |\n",
      "|  4   |      Tipranavir      | SARS_CoV2_endoRNAse |      2.65     |\n",
      "|  5   |      Baloxavir       | SARS_CoV2_endoRNAse |      3.88     |\n",
      "|  6   |      Boceprevir      | SARS_CoV2_endoRNAse |      3.96     |\n",
      "|  7   |     Daclatasvir      | SARS_CoV2_endoRNAse |      4.57     |\n",
      "|  8   |     Oseltamivir      | SARS_CoV2_endoRNAse |      5.11     |\n",
      "|  9   |      Vicriviroc      | SARS_CoV2_endoRNAse |      5.27     |\n",
      "|  10  |     Glecaprevir      | SARS_CoV2_endoRNAse |      5.33     |\n",
      "|  11  |    Fosamprenavir     | SARS_CoV2_endoRNAse |      5.34     |\n",
      "|  12  |      Telaprevir      | SARS_CoV2_endoRNAse |      5.64     |\n",
      "|  13  |      Nelfinavir      | SARS_CoV2_endoRNAse |      7.91     |\n",
      "|  14  |      Amantadine      | SARS_CoV2_endoRNAse |      7.91     |\n",
      "|  15  |      Foscarnet       | SARS_CoV2_endoRNAse |     10.88     |\n",
      "|  16  |      Maraviroc       | SARS_CoV2_endoRNAse |     12.47     |\n",
      "|  17  |      Pleconaril      | SARS_CoV2_endoRNAse |     13.01     |\n",
      "|  18  |       Abacavir       | SARS_CoV2_endoRNAse |     15.48     |\n",
      "|  19  |      Sofosbuvir      | SARS_CoV2_endoRNAse |     19.61     |\n",
      "|  20  |     Rimantadine      | SARS_CoV2_endoRNAse |     25.77     |\n",
      "|  21  |       Arbidol        | SARS_CoV2_endoRNAse |     26.51     |\n",
      "|  22  |      Tenofovir       | SARS_CoV2_endoRNAse |     29.80     |\n",
      "|  23  |       Descovy        | SARS_CoV2_endoRNAse |     29.80     |\n",
      "|  24  |      Atazanavir      | SARS_CoV2_endoRNAse |     32.23     |\n",
      "|  25  |      Letermovir      | SARS_CoV2_endoRNAse |     32.71     |\n",
      "|  26  |      Ritonavir       | SARS_CoV2_endoRNAse |     35.84     |\n",
      "|  27  |      Simeprevir      | SARS_CoV2_endoRNAse |     36.19     |\n",
      "|  28  |      Saquinavir      | SARS_CoV2_endoRNAse |     37.63     |\n",
      "|  29  |      Remdesivir      | SARS_CoV2_endoRNAse |     38.42     |\n",
      "|  30  |      Etravirine      | SARS_CoV2_endoRNAse |     40.88     |\n",
      "checkout ./save_folder/results_aggregation/repurposing.txt for the whole list\n",
      "\n"
     ]
    }
   ],
   "source": [
    "oneliner.repurpose(target = target, \n",
    "                    target_name = target_name, \n",
    "                    X_repurpose = X_repurpose,\n",
    "                    drug_names = drug_names,\n",
    "                    save_dir = './save_folder',\n",
    "                    pretrained_dir = './save_folder/pretrained_models/DeepPurpose_BindingDB/',\n",
    "                    agg = 'max_effect')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Loading customized repurposing dataset...\n",
      "Checking if pretrained directory is valid...\n",
      "Beginning to load the pretrained models...\n",
      "Using pretrained model and making predictions...\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 1 with drug encoding MPNN and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 2 with drug encoding CNN and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 3 with drug encoding Morgan and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "-- Encoding AAC takes time. Time Reference: 24s for ~100 sequences in a CPU. Calculate your time by the unique target sequence #, instead of the entire dataset.\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 4 with drug encoding Morgan and target encoding AAC are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "-- Encoding AAC takes time. Time Reference: 24s for ~100 sequences in a CPU. Calculate your time by the unique target sequence #, instead of the entire dataset.\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 5 with drug encoding Daylight and target encoding AAC are done...\n",
      "-------------\n",
      "models prediction finished...\n",
      "aggregating results...\n",
      "---------------\n",
      "Drug Repurposing Result for SARS_CoV2_endoRNAse\n",
      "+------+----------------------+---------------------+---------------+\n",
      "| Rank |      Drug Name       |     Target Name     | Binding Score |\n",
      "+------+----------------------+---------------------+---------------+\n",
      "|  1   |     Daclatasvir      | SARS_CoV2_endoRNAse |     214.89    |\n",
      "|  2   |      Simeprevir      | SARS_CoV2_endoRNAse |     250.15    |\n",
      "|  3   |      Sofosbuvir      | SARS_CoV2_endoRNAse |     290.50    |\n",
      "|  4   |      Vicriviroc      | SARS_CoV2_endoRNAse |     400.00    |\n",
      "|  5   |      Etravirine      | SARS_CoV2_endoRNAse |     417.98    |\n",
      "|  6   |      Atazanavir      | SARS_CoV2_endoRNAse |     421.78    |\n",
      "|  7   |      Letermovir      | SARS_CoV2_endoRNAse |     456.19    |\n",
      "|  8   |      Darunavir       | SARS_CoV2_endoRNAse |     459.65    |\n",
      "|  9   |      Lopinavir       | SARS_CoV2_endoRNAse |     459.94    |\n",
      "|  10  |      Maraviroc       | SARS_CoV2_endoRNAse |     464.10    |\n",
      "|  11  |     Rilpivirine      | SARS_CoV2_endoRNAse |     468.50    |\n",
      "|  12  |    Fosamprenavir     | SARS_CoV2_endoRNAse |     473.33    |\n",
      "|  13  |      Peramivir       | SARS_CoV2_endoRNAse |     512.31    |\n",
      "|  14  |      Telaprevir      | SARS_CoV2_endoRNAse |     574.14    |\n",
      "|  15  |      Amprenavir      | SARS_CoV2_endoRNAse |     588.81    |\n",
      "|  16  |      Amantadine      | SARS_CoV2_endoRNAse |     599.07    |\n",
      "|  17  |     Grazoprevir      | SARS_CoV2_endoRNAse |     628.48    |\n",
      "|  18  |      Nelfinavir      | SARS_CoV2_endoRNAse |     648.46    |\n",
      "|  19  |      Boceprevir      | SARS_CoV2_endoRNAse |     799.77    |\n",
      "|  20  |     Elvitegravir     | SARS_CoV2_endoRNAse |     817.42    |\n",
      "|  21  |      Doravirine      | SARS_CoV2_endoRNAse |     853.32    |\n",
      "|  22  |     Raltegravir      | SARS_CoV2_endoRNAse |     872.32    |\n",
      "|  23  |       Abacavir       | SARS_CoV2_endoRNAse |     912.43    |\n",
      "|  24  |     Delavirdine      | SARS_CoV2_endoRNAse |     920.16    |\n",
      "|  25  |      Saquinavir      | SARS_CoV2_endoRNAse |     925.00    |\n",
      "|  26  | Tenofovir_disoproxil | SARS_CoV2_endoRNAse |     969.32    |\n",
      "|  27  |      Ritonavir       | SARS_CoV2_endoRNAse |     969.38    |\n",
      "|  28  |     Glecaprevir      | SARS_CoV2_endoRNAse |    1078.72    |\n",
      "|  29  |      Pleconaril      | SARS_CoV2_endoRNAse |    1101.19    |\n",
      "|  30  |      Tenofovir       | SARS_CoV2_endoRNAse |    1266.07    |\n",
      "checkout ./save_folder/results_aggregation/repurposing.txt for the whole list\n",
      "\n"
     ]
    }
   ],
   "source": [
    "oneliner.repurpose(target = target, \n",
    "                    target_name = target_name, \n",
    "                    X_repurpose = X_repurpose,\n",
    "                    drug_names = drug_names,\n",
    "                    save_dir = './save_folder',\n",
    "                    pretrained_dir = './save_folder/pretrained_models/DeepPurpose_BindingDB/',\n",
    "                    agg = 'agg_mean_max')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Loading customized repurposing dataset...\n",
      "Checking if pretrained directory is valid...\n",
      "Beginning to load the pretrained models...\n",
      "Using pretrained model and making predictions...\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 1 with drug encoding MPNN and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 2 with drug encoding CNN and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 3 with drug encoding Morgan and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "-- Encoding AAC takes time. Time Reference: 24s for ~100 sequences in a CPU. Calculate your time by the unique target sequence #, instead of the entire dataset.\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 4 with drug encoding Morgan and target encoding AAC are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "-- Encoding AAC takes time. Time Reference: 24s for ~100 sequences in a CPU. Calculate your time by the unique target sequence #, instead of the entire dataset.\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 5 with drug encoding Daylight and target encoding AAC are done...\n",
      "-------------\n",
      "models prediction finished...\n",
      "aggregating results...\n",
      "---------------\n",
      "Drug Repurposing Result for SARS_CoV2_2_O_ribose_methyltransferase\n",
      "+------+----------------------+----------------------------------------+---------------+\n",
      "| Rank |      Drug Name       |              Target Name               | Binding Score |\n",
      "+------+----------------------+----------------------------------------+---------------+\n",
      "|  1   |      Sofosbuvir      | SARS_CoV2_2_O_ribose_methyltransferase |     364.51    |\n",
      "|  2   |     Daclatasvir      | SARS_CoV2_2_O_ribose_methyltransferase |     424.59    |\n",
      "|  3   |      Simeprevir      | SARS_CoV2_2_O_ribose_methyltransferase |     512.20    |\n",
      "|  4   |      Vicriviroc      | SARS_CoV2_2_O_ribose_methyltransferase |     739.15    |\n",
      "|  5   |      Etravirine      | SARS_CoV2_2_O_ribose_methyltransferase |     776.94    |\n",
      "|  6   |      Atazanavir      | SARS_CoV2_2_O_ribose_methyltransferase |     835.38    |\n",
      "|  7   |      Amantadine      | SARS_CoV2_2_O_ribose_methyltransferase |     849.80    |\n",
      "|  8   |     Rilpivirine      | SARS_CoV2_2_O_ribose_methyltransferase |     882.95    |\n",
      "|  9   |      Letermovir      | SARS_CoV2_2_O_ribose_methyltransferase |     892.38    |\n",
      "|  10  |      Ritonavir       | SARS_CoV2_2_O_ribose_methyltransferase |     916.95    |\n",
      "|  11  |      Lopinavir       | SARS_CoV2_2_O_ribose_methyltransferase |     953.41    |\n",
      "|  12  |      Maraviroc       | SARS_CoV2_2_O_ribose_methyltransferase |     956.00    |\n",
      "|  13  |      Darunavir       | SARS_CoV2_2_O_ribose_methyltransferase |     956.72    |\n",
      "|  14  |      Peramivir       | SARS_CoV2_2_O_ribose_methyltransferase |     968.37    |\n",
      "|  15  |     Grazoprevir      | SARS_CoV2_2_O_ribose_methyltransferase |     976.05    |\n",
      "|  16  |    Fosamprenavir     | SARS_CoV2_2_O_ribose_methyltransferase |     977.57    |\n",
      "|  17  |      Efavirenz       | SARS_CoV2_2_O_ribose_methyltransferase |    1075.01    |\n",
      "|  18  |      Telaprevir      | SARS_CoV2_2_O_ribose_methyltransferase |    1136.33    |\n",
      "|  19  |     Elvitegravir     | SARS_CoV2_2_O_ribose_methyltransferase |    1188.12    |\n",
      "|  20  |      Tenofovir       | SARS_CoV2_2_O_ribose_methyltransferase |    1200.92    |\n",
      "|  21  |       Descovy        | SARS_CoV2_2_O_ribose_methyltransferase |    1200.92    |\n",
      "|  22  |      Amprenavir      | SARS_CoV2_2_O_ribose_methyltransferase |    1222.05    |\n",
      "|  23  |      Nelfinavir      | SARS_CoV2_2_O_ribose_methyltransferase |    1346.06    |\n",
      "|  24  | Tenofovir_disoproxil | SARS_CoV2_2_O_ribose_methyltransferase |    1352.00    |\n",
      "|  25  |     Tromantadine     | SARS_CoV2_2_O_ribose_methyltransferase |    1362.92    |\n",
      "|  26  |      Doravirine      | SARS_CoV2_2_O_ribose_methyltransferase |    1508.91    |\n",
      "|  27  |     Dolutegravir     | SARS_CoV2_2_O_ribose_methyltransferase |    1547.19    |\n",
      "|  28  |       Abacavir       | SARS_CoV2_2_O_ribose_methyltransferase |    1614.96    |\n",
      "|  29  |     Delavirdine      | SARS_CoV2_2_O_ribose_methyltransferase |    1699.89    |\n",
      "|  30  |      Saquinavir      | SARS_CoV2_2_O_ribose_methyltransferase |    1766.76    |\n",
      "checkout ./save_folder/results_aggregation/repurposing.txt for the whole list\n",
      "\n"
     ]
    }
   ],
   "source": [
    "target, target_name = dataset.load_SARS_CoV2_2_O_ribose_methyltransferase()\n",
    "oneliner.repurpose(target = target, \n",
    "                    target_name = target_name, \n",
    "                    X_repurpose = X_repurpose,\n",
    "                    drug_names = drug_names,\n",
    "                    save_dir = './save_folder',\n",
    "                    pretrained_dir = './save_folder/pretrained_models/DeepPurpose_BindingDB/',\n",
    "                    agg = 'mean')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Loading customized repurposing dataset...\n",
      "Checking if pretrained directory is valid...\n",
      "Beginning to load the pretrained models...\n",
      "Using pretrained model and making predictions...\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 1 with drug encoding MPNN and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 2 with drug encoding CNN and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 3 with drug encoding Morgan and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "-- Encoding AAC takes time. Time Reference: 24s for ~100 sequences in a CPU. Calculate your time by the unique target sequence #, instead of the entire dataset.\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 4 with drug encoding Morgan and target encoding AAC are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "-- Encoding AAC takes time. Time Reference: 24s for ~100 sequences in a CPU. Calculate your time by the unique target sequence #, instead of the entire dataset.\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 5 with drug encoding Daylight and target encoding AAC are done...\n",
      "-------------\n",
      "models prediction finished...\n",
      "aggregating results...\n",
      "---------------\n",
      "Drug Repurposing Result for SARS_CoV2_2_O_ribose_methyltransferase\n",
      "+------+----------------------+----------------------------------------+---------------+\n",
      "| Rank |      Drug Name       |              Target Name               | Binding Score |\n",
      "+------+----------------------+----------------------------------------+---------------+\n",
      "|  1   |      Lopinavir       | SARS_CoV2_2_O_ribose_methyltransferase |      0.24     |\n",
      "|  2   |      Darunavir       | SARS_CoV2_2_O_ribose_methyltransferase |      0.31     |\n",
      "|  3   |      Amprenavir      | SARS_CoV2_2_O_ribose_methyltransferase |      0.92     |\n",
      "|  4   |      Tipranavir      | SARS_CoV2_2_O_ribose_methyltransferase |      1.46     |\n",
      "|  5   |      Baloxavir       | SARS_CoV2_2_O_ribose_methyltransferase |      1.87     |\n",
      "|  6   |      Boceprevir      | SARS_CoV2_2_O_ribose_methyltransferase |      2.23     |\n",
      "|  7   |     Glecaprevir      | SARS_CoV2_2_O_ribose_methyltransferase |      2.48     |\n",
      "|  8   |     Oseltamivir      | SARS_CoV2_2_O_ribose_methyltransferase |      2.83     |\n",
      "|  9   |      Telaprevir      | SARS_CoV2_2_O_ribose_methyltransferase |      3.00     |\n",
      "|  10  |      Nelfinavir      | SARS_CoV2_2_O_ribose_methyltransferase |      3.35     |\n",
      "|  11  |      Maraviroc       | SARS_CoV2_2_O_ribose_methyltransferase |      4.97     |\n",
      "|  12  |     Daclatasvir      | SARS_CoV2_2_O_ribose_methyltransferase |      5.68     |\n",
      "|  13  |      Vicriviroc      | SARS_CoV2_2_O_ribose_methyltransferase |      6.15     |\n",
      "|  14  |    Fosamprenavir     | SARS_CoV2_2_O_ribose_methyltransferase |      6.23     |\n",
      "|  15  |      Amantadine      | SARS_CoV2_2_O_ribose_methyltransferase |      9.76     |\n",
      "|  16  |      Etravirine      | SARS_CoV2_2_O_ribose_methyltransferase |     10.07     |\n",
      "|  17  |      Foscarnet       | SARS_CoV2_2_O_ribose_methyltransferase |     11.51     |\n",
      "|  18  |      Atazanavir      | SARS_CoV2_2_O_ribose_methyltransferase |     11.70     |\n",
      "|  19  |      Entecavir       | SARS_CoV2_2_O_ribose_methyltransferase |     11.73     |\n",
      "|  20  |      Pleconaril      | SARS_CoV2_2_O_ribose_methyltransferase |     11.91     |\n",
      "|  21  |      Simeprevir      | SARS_CoV2_2_O_ribose_methyltransferase |     13.29     |\n",
      "|  22  |     Rilpivirine      | SARS_CoV2_2_O_ribose_methyltransferase |     13.73     |\n",
      "|  23  |       Abacavir       | SARS_CoV2_2_O_ribose_methyltransferase |     15.62     |\n",
      "|  24  |      Sofosbuvir      | SARS_CoV2_2_O_ribose_methyltransferase |     18.38     |\n",
      "|  25  |      Saquinavir      | SARS_CoV2_2_O_ribose_methyltransferase |     19.33     |\n",
      "|  26  |     Delavirdine      | SARS_CoV2_2_O_ribose_methyltransferase |     20.24     |\n",
      "|  27  |       Arbidol        | SARS_CoV2_2_O_ribose_methyltransferase |     20.65     |\n",
      "|  28  |      Peramivir       | SARS_CoV2_2_O_ribose_methyltransferase |     24.92     |\n",
      "|  29  |     Raltegravir      | SARS_CoV2_2_O_ribose_methyltransferase |     25.47     |\n",
      "|  30  |      Tenofovir       | SARS_CoV2_2_O_ribose_methyltransferase |     25.94     |\n",
      "checkout ./save_folder/results_aggregation/repurposing.txt for the whole list\n",
      "\n"
     ]
    }
   ],
   "source": [
    "oneliner.repurpose(target = target, \n",
    "                    target_name = target_name, \n",
    "                    X_repurpose = X_repurpose,\n",
    "                    drug_names = drug_names,\n",
    "                    save_dir = './save_folder',\n",
    "                    pretrained_dir = './save_folder/pretrained_models/DeepPurpose_BindingDB/',\n",
    "                    agg = 'max_effect')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Loading customized repurposing dataset...\n",
      "Checking if pretrained directory is valid...\n",
      "Beginning to load the pretrained models...\n",
      "Using pretrained model and making predictions...\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 1 with drug encoding MPNN and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 2 with drug encoding CNN and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 3 with drug encoding Morgan and target encoding CNN are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "-- Encoding AAC takes time. Time Reference: 24s for ~100 sequences in a CPU. Calculate your time by the unique target sequence #, instead of the entire dataset.\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 4 with drug encoding Morgan and target encoding AAC are done...\n",
      "-------------\n",
      "repurposing...\n",
      "in total: 82 drug-target pairs\n",
      "encoding drug...\n",
      "unique drugs: 81\n",
      "drug encoding finished...\n",
      "encoding protein...\n",
      "unique target sequence: 1\n",
      "-- Encoding AAC takes time. Time Reference: 24s for ~100 sequences in a CPU. Calculate your time by the unique target sequence #, instead of the entire dataset.\n",
      "protein encoding finished...\n",
      "Done.\n",
      "predicting...\n",
      "---------------\n",
      "Predictions from model 5 with drug encoding Daylight and target encoding AAC are done...\n",
      "-------------\n",
      "models prediction finished...\n",
      "aggregating results...\n",
      "---------------\n",
      "Drug Repurposing Result for SARS_CoV2_2_O_ribose_methyltransferase\n",
      "+------+----------------------+----------------------------------------+---------------+\n",
      "| Rank |      Drug Name       |              Target Name               | Binding Score |\n",
      "+------+----------------------+----------------------------------------+---------------+\n",
      "|  1   |      Sofosbuvir      | SARS_CoV2_2_O_ribose_methyltransferase |     191.45    |\n",
      "|  2   |     Daclatasvir      | SARS_CoV2_2_O_ribose_methyltransferase |     215.14    |\n",
      "|  3   |      Simeprevir      | SARS_CoV2_2_O_ribose_methyltransferase |     262.75    |\n",
      "|  4   |      Vicriviroc      | SARS_CoV2_2_O_ribose_methyltransferase |     372.65    |\n",
      "|  5   |      Etravirine      | SARS_CoV2_2_O_ribose_methyltransferase |     393.50    |\n",
      "|  6   |      Atazanavir      | SARS_CoV2_2_O_ribose_methyltransferase |     423.54    |\n",
      "|  7   |      Amantadine      | SARS_CoV2_2_O_ribose_methyltransferase |     429.78    |\n",
      "|  8   |     Rilpivirine      | SARS_CoV2_2_O_ribose_methyltransferase |     448.34    |\n",
      "|  9   |      Letermovir      | SARS_CoV2_2_O_ribose_methyltransferase |     462.16    |\n",
      "|  10  |      Lopinavir       | SARS_CoV2_2_O_ribose_methyltransferase |     476.83    |\n",
      "|  11  |      Darunavir       | SARS_CoV2_2_O_ribose_methyltransferase |     478.52    |\n",
      "|  12  |      Ritonavir       | SARS_CoV2_2_O_ribose_methyltransferase |     479.50    |\n",
      "|  13  |      Maraviroc       | SARS_CoV2_2_O_ribose_methyltransferase |     480.49    |\n",
      "|  14  |    Fosamprenavir     | SARS_CoV2_2_O_ribose_methyltransferase |     491.90    |\n",
      "|  15  |      Peramivir       | SARS_CoV2_2_O_ribose_methyltransferase |     496.64    |\n",
      "|  16  |     Grazoprevir      | SARS_CoV2_2_O_ribose_methyltransferase |     523.70    |\n",
      "|  17  |      Telaprevir      | SARS_CoV2_2_O_ribose_methyltransferase |     569.67    |\n",
      "|  18  |      Amprenavir      | SARS_CoV2_2_O_ribose_methyltransferase |     611.48    |\n",
      "|  19  |      Tenofovir       | SARS_CoV2_2_O_ribose_methyltransferase |     613.43    |\n",
      "|  20  |       Descovy        | SARS_CoV2_2_O_ribose_methyltransferase |     613.43    |\n",
      "|  21  |     Elvitegravir     | SARS_CoV2_2_O_ribose_methyltransferase |     639.14    |\n",
      "|  22  |      Efavirenz       | SARS_CoV2_2_O_ribose_methyltransferase |     669.05    |\n",
      "|  23  |      Nelfinavir      | SARS_CoV2_2_O_ribose_methyltransferase |     674.70    |\n",
      "|  24  | Tenofovir_disoproxil | SARS_CoV2_2_O_ribose_methyltransferase |     719.19    |\n",
      "|  25  |      Doravirine      | SARS_CoV2_2_O_ribose_methyltransferase |     778.37    |\n",
      "|  26  |       Abacavir       | SARS_CoV2_2_O_ribose_methyltransferase |     815.29    |\n",
      "|  27  |     Delavirdine      | SARS_CoV2_2_O_ribose_methyltransferase |     860.06    |\n",
      "|  28  |     Dolutegravir     | SARS_CoV2_2_O_ribose_methyltransferase |     867.61    |\n",
      "|  29  |      Saquinavir      | SARS_CoV2_2_O_ribose_methyltransferase |     893.04    |\n",
      "|  30  |     Tromantadine     | SARS_CoV2_2_O_ribose_methyltransferase |     899.18    |\n",
      "checkout ./save_folder/results_aggregation/repurposing.txt for the whole list\n",
      "\n"
     ]
    }
   ],
   "source": [
    "oneliner.repurpose(target = target, \n",
    "                    target_name = target_name, \n",
    "                    X_repurpose = X_repurpose,\n",
    "                    drug_names = drug_names,\n",
    "                    save_dir = './save_folder',\n",
    "                    pretrained_dir = './save_folder/pretrained_models/DeepPurpose_BindingDB/',\n",
    "                    agg = 'agg_mean_max')"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
